﻿@{
    string action = "";
    if (ViewBag.Action != null) {
        action = (string)ViewBag.Action;
    }
    string formAction = "";
    switch (action) {
        case "C":
            formAction = Url.Action("Create");
            break;
        case "U":
            formAction = Url.Action("Update");
            break;
    }
}
<div title="客户信息">
    <form id="frmMain" method="post" action="@formAction">
    @Html.ValidationSummary(true)
    </form>
</div>
<div class="form-bar">
    <input id="btnsubmit" type="button" class="button" name="submit" value="提交" />
</div>
@section footer{
    <script src="@Url.Content("~/Scripts/jquery/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery/jquery.metadata.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery/messages_cn.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.form.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/LG.js")" type="text/javascript"></script>
    <script type="text/javascript">
        var getid = '@ViewBag.Id';
        var geturl = '@Url.Action("Get")';
        var action = '@action'.toUpperCase();
        var editable = action == 'U' || action == 'C';
        var isnew = action == 'C';
        var fields = [
            { display: "公司名称", name: "CustomerName", newline: false, labelWidth: 100, width: 220, space: 30, type: "text", group: "客户信息",
                validate: { required: true, maxlength: 50 }
            }
            , { display: "简称", name: "ShortName", newline: false, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 50 },
                validate: { required: true, maxlength: 20 }
            }
            , { display: "助记码", name: "MnCode", newline: true, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 50 },
                validate: { maxlength: 50 }
            }
            , { display: "公司地址", name: "Address", newline: false, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 50 },
                validate: { maxlength: 50 }
            }
            , { display: "联系电话", name: "Phones", newline: true, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 50 },
                validate: { maxlength: 50 }
            }
            , { display: "邮政编码", name: "PostCode", newline: false, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 10 },
                validate: { maxlength: 50 }
            }
            , { display: "联系人", name: "Contract", newline: true, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 20 },
                validate: { maxlength: 50 }
            }
            , { display: "客户状态", name: "Status", newline: false, labelWidth: 100, width: 220, space: 30, type: "text", validate: { maxlength: 20 },
                validate: { required: true, maxlength: 1 }
            }
            , { display: "备注", name: "Remarks", newline: true, labelWidth: 100, width: 520, space: 30, type: "textarea",
                validate: { maxlength: 400 }
            }
        ];
    </script>
}
